home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 12 / Cream of the Crop 12 (Part II) / Cream of the Crop 12 (Part II).iso / OS2 / NFTP060.ZIP / install.cmd < prev    next >
Encoding:
Text File  |  1996-03-31  |  5.0 KB  |  148 lines

  1. /* REXX */
  2.  
  3. /* Load RexxUtil extensions */
  4. if RxFuncQuery("SysLoadFuncs") then do
  5.     say "loading RexxUtil extensions..."
  6.     call RxFuncAdd "SysLoadFuncs","RexxUtil","SysLoadFuncs"
  7.     if result \= "0" then do
  8.         say "error loading RexxUtil.dll"
  9.         exit
  10.     end
  11.     call SysLoadFuncs
  12. end
  13.  
  14. /* ask user about directories etc. */
  15. Call SysCls
  16. say
  17. say "NFTP Version 0.60 installation"
  18. say
  19. say "This script will do the following:"
  20. say "1) copy required files into the directory you specified;"
  21. say "2) set up default settings in nftp.ini"
  22. say "3) create two objects on your desktop:"
  23. say "   one for NFTP itself and another for its manual."
  24. say
  25. say "Enter destination directory (where NFTP files will be installed)."
  26. say "If you wish to install NFTP into the subtree (eg, ""d:\apps\tcpip\nftp"")"
  27. say "you have to create upper directory first (""d:\apps\tcpip"" in the"
  28. say "above example)".
  29. parse pull destpath .
  30. if destpath = "" then exit
  31. say
  32. say "Enter default path for downloads (e.g., ""d:\tmp"")."
  33. say "This directory should reside on HPFS drive or you'll be unable"
  34. say "to download files which are not 8.3-compliant."
  35. parse pull dlpath .
  36. if dlpath = "" then exit
  37. say
  38. say "Enter your e-mail address (to be used as a password for anonymous logins):"
  39. parse pull email .
  40. if email = "" then exit
  41.  
  42. destpath = strip(destpath, "T", "\")
  43. dlpath = strip(dlpath, "T", "\")
  44.  
  45. /* verify choices */
  46. say
  47. say copies("-", 75)
  48. say "You are going to install NFTP into the directory:" destpath
  49. say "Default download directory is:" dlpath
  50. say "Your e-mail address:" email
  51. say
  52. say "Press Ctrl-C to abort or any other key to continue"
  53. say
  54. '@pause >nul'
  55. say
  56.  
  57. /* creating target directories if necessary */
  58. call SysFileTree destpath, "srch", "D"
  59. if srch.0 = 0 then do
  60.     rc = SysMkDir(destpath)
  61.     if rc <> 0 then do
  62.         say "Fatal error: cannot create directory" destpath
  63.         exit
  64.     end
  65. end
  66.  
  67. call SysFileTree dlpath, "srch", "D"
  68. if srch.0 = 0 then do
  69.     rc = SysMkDir(dlpath)
  70.     if rc <> 0 then do
  71.         say "Fatal error: cannot create directory" dlpath
  72.         exit
  73.     end
  74. end
  75.  
  76. /* copying NFTP files */
  77. '@copy nftp.exe     'destpath'\nftp.exe     >nul'
  78. '@copy nftp.ico     'destpath'\nftp.ico     >nul'
  79. '@copy nftp-opt.exe 'destpath'\nftp-opt.exe >nul'
  80. '@copy nftp-man.htm 'destpath'\nftp-man.htm >nul'
  81. '@copy nftp-man.txt 'destpath'\nftp-man.txt >nul'
  82. '@copy nftp-man.ico 'destpath'\nftp-man.ico >nul'
  83.  
  84. /* making sure we will not overwrite existing nftp.mrk */
  85. if stream(destpath"\nftp.mrk", "C", "QUERY EXISTS") == "" then
  86.     '@copy nftp.mrk 'destpath'\nftp.mrk >nul'
  87.  
  88. /* checking 'nftp.ini' presence */
  89. usenewini = 0
  90. if stream(destpath"\nftp.ini", "C", "QUERY EXISTS") <> "" then 
  91. do
  92.     say destpath"\nftp.ini already exists."
  93.     say "File ""nftp.new"" will be created in the" destpath
  94.     say "Please examine it and add new options to your"
  95.     say "existing configuration file"
  96.     usenewini = 1
  97. end
  98.  
  99. if usenewini = 1 then newinifile = destpath"\nftp.new"
  100. else                  newinifile = destpath"\nftp.ini"
  101. call SysFileDelete newinifile
  102.  
  103. /* creating new 'nftp.ini' and customizing it slightly */
  104. signal off notready
  105. do forever
  106.     lin = linein("nftp.ini")
  107.     newlin = lin
  108.     if left(lin,1) <> ";" then
  109.     do
  110.         if substr(lin,1,19) = 'anonymous-password=' then
  111.             newlin = 'anonymous-password="'email'"'
  112.         if substr(lin,1,19) = 'log-transfers-name=' then
  113.             newlin = 'log-transfers-name="'destpath'\nftp.fls"'
  114.         if substr(lin,1,15) = 'bookmarks-file=' then
  115.             newlin = 'bookmarks-file="'destpath'\nftp.mrk"'
  116.     end
  117.     rc = lineout(newinifile, newlin)
  118.     if lin = "" & left(stream("nftp.ini"),5) <> "READY" then leave
  119. end
  120. call stream "nftp.ini", "C", "CLOSE"
  121. call stream newinifile, "C", "CLOSE"
  122. say "Files were copied to" destpath
  123.  
  124. /* creating WPS objects */
  125. say
  126. settings = 'EXENAME='destpath'\nftp.exe;STARTUPDIR='dlpath';PARAMETERS=[FTP server to log in?];PROGTYPE=WINDOWABLEVIO;NOAUTOCLOSE=YES;MINIMIZED=NO;ICONFILE=nftp.ico'
  127. rc = SysCreateObject('WPProgram', 'NFTP', '<WP_DESKTOP>', settings, 'replace')
  128. if rc != 1 then say "Cannot create program object"
  129. else            say "Program       object was created"
  130. settings = 'EXENAME=explore.exe;PARAMETERS=-q 'destpath'\nftp-man.htm;PROGTYPE=PM;MINIMIZED=NO;ICONFILE=nftp-man.ico'
  131. rc = SysCreateObject('WPProgram', 'NFTP manual', '<WP_DESKTOP>', settings, 'replace')
  132. if rc != 1 then say "Cannot create documentation object"
  133. else            say "Documentation object was created"
  134.  
  135. /* looks like we're done... */
  136. say
  137. say "Installation complete."
  138. say "You can customize "destpath"\nftp.ini according your preferences."
  139. say
  140. say "If you don't have EMX runtime support installed, copy emx.dll into"
  141. say "any directory specified in your LIBPATH. File 'emx.dll' provided"
  142. say "with NFTP version 0.60 has version number ""0.9b, fixlevel 3""."
  143. say "Read NFTP documentation about obtaining complete EMX runtime support"
  144. say "package and its source code."
  145. say
  146. '@pause'
  147. Exit
  148.